package com.lib76.buildCode.dto;

import com.lib76.DBInfo.model.po.mysql.DatabaseTable;
import com.lib76.buildCode.model.Project;

/**
 * DTO转换工厂
 * @author 张浩
 * @version 0.0.1
 */
public class DtoFactory {

	public static ProjectData changeProjectData(Project project){
		ProjectData result = new ProjectData();
		result.setProjectCode(project.getProjectCode());
		result.setProjectName(project.getProjectName());
		result.setProjectType(project.getProjectType());
		result.setProjectPackage(project.getProjectPackage());
		if(project.getDbConfig() != null){
			result.setConfigDb(true);
		}
		if(project.getPageConfig() != null){
			result.setConfigHtml(true);
		}
		if(project.getPlugs() != null){
			result.setConfigPlug(true);
		}
		return result;
	}
	
	public static DbTableData changeDbTableData(DatabaseTable table){
		DbTableData result = new DbTableData();
		result.setTableScheam(table.getTableSchema());
		result.setTableName(table.getTableName());
		return result;
	}
}
